﻿using System.Web;
using System.Web.Optimization;

namespace JsxyUIS.WebClient
{
    public class BundleConfig
    {
        // 有关绑定的详细信息，请访问 http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            //jquery 基础库
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Content/jqext/jquery/jquery-1.11.0.js"));

            //jqueyr-easyui-1.3.6基础css
            bundles.Add(new StyleBundle("~/bundles/jqueyr-easyui-css").Include(
                "~/Content/jqext/jquery-easyui-theme/default/easyui.css",
                "~/Content/jqext/jquery-easyui-theme/icon.css"));

            //jqueyr-easyui-1.3.6基础库和中文语言包
            bundles.Add(new ScriptBundle("~/bundles/jqueyr-easyui").Include(
                "~/Content/jqext/jquery-easyui-1.3.6/jquery.easyui.min.js",
                "~/Content/jqext/jquery-easyui-1.3.6/locale/easyui-lang-zh_CN.js"));

            //jquery.jdirk.js
            bundles.Add(new ScriptBundle("~/bundles/jquery-jdirk").Include(
                "~/Content/jqext/jquery.jdirk.js"));

            //jquery-easyui-extensions
            bundles.Add(new StyleBundle("~/bundles/jquery-easyui-extensions-css").Include(
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.css"));
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-extensions-js").Include(
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.progressbar.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.linkbutton.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.form.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.validatebox.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.combo.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.combobox.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.menu.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.serachbox.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.panel.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.window.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.dialog.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.layout.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.tree.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.datagrid.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.treegrid.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.combotree.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.combogrid.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.tabs.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.theme.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.icons.js",
                "~/Content/jqext/jeasyui-extensions/jeasyui.extensions.gridselector.js"
                ));

            //jquery-easyui-icons
            bundles.Add(new StyleBundle("~/bundles/jquery-easyui-icons-css").Include(
                "~/Content/jqext/icons/icon-all.css"));
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-icons-js").Include(
                "~/Content/jqext/icons/jeasyui.icons.all.js"));

            //jquery-easyui-plugins
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-plugins").Include(
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-toolbar/jquery.toolbar.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-comboicons/jquery.comboicons.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-comboselector/jquery.comboselector.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-portal/jquery.portal.js"));
            
            //jquery-easyui-plugins-with-thirdpath
            //ueditor
            bundles.Add(new StyleBundle("~/bundles/jquery-easyui-plugins-ueditor-css").Include(
                "~/Content/jqext/plugins/ueditor/ue1.3.6-utf8-net/themes/default/css/ueditor.css"));
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-plugins-ueditor-js").Include(
                "~/Content/jqext/plugins/ueditor/ue1.3.6-utf8-net/ueditor.config.js",
                "~/Content/jqext/plugins/ueditor/ue1.3.6-utf8-net/ueditor.all.js",
                "~/Content/jqext/plugins/ueditor/ue1.3.6-utf8-net/lang/zh-cn/zh-cn.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-ueditor/jquery.ueditor.js"
                ));

            //my97
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-plugins-my97-js").Include(
                "~/Content/jqext/plugins/My97DatePicker/WdatePicker.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-my97/jquery.my97.js"
                ));

            //codemirror
            bundles.Add(new StyleBundle("~/bundles/jquery-easyui-plugins-codemirror-css").Include(
                "~/Content/jqext/plugins/codemirror-4.1/lib/codemirror.css"));
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-plugins-codemirror-js").Include(
                "~/Content/jqext/plugins/codemirror-4.1/lib/codemirror.js",
                "~/Content/jqext/plugins/codemirror-4.1/mode/xml/xml.js",
                "~/Content/jqext/plugins/codemirror-4.1/mode/javascript/javascript.js",
                "~/Content/jqext/plugins/codemirror-4.1/mode/vbscript/vbscript.js",
                "~/Content/jqext/plugins/codemirror-4.1/mode/css/css.js",
                "~/Content/jqext/codemirror-4.1/mode/htmlmixed/htmlmixed.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-codemirror/jquery.codemirror.js"
                ));

            //euploadify
            bundles.Add(new StyleBundle("~/bundles/jquery-easyui-plugins-euploadify-css").Include(
                "~/Content/jqext/plugins/uploadify/uploadify.css"));
            bundles.Add(new ScriptBundle("~/bundles/jquery-easyui-plugins-euploadify-js").Include(
                "~/Content/jqext/plugins/uploadify/jquery.uploadify.js",
                "~/Content/jqext/jeasyui-extensions/jquery-easyui-euploadify/jquery.euploadify.js"
                ));


            BundleTable.EnableOptimizations = EnableOptimizations;
        }


        static bool EnableOptimizations 
        {
            get 
            {
                bool ret = false;
                string b = System.Configuration.ConfigurationManager.AppSettings["EnableOptimizations"];
                bool.TryParse(b, out ret);
                return ret;
            }
        }
    }
}
